<!doctype html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="__public__/static/css/normalize.css">
    <link rel="stylesheet" href="__public__/admin/css/style.css">
    <script src="__public__/static/js/jquery-2.2.0.min.js"></script>
    <title>数字串串乐活动管理首页</title>

</head>
<body>

<section class="home">
    <div class="toggle">
        <h1>数字串串乐活动管理</h1>
        <div id="link">
            <a href="javascript:;" data="1">开启活动</a>
            <!--<a href="javascript:;" data="0" class="active">关闭活动</a>-->
        </div>
    </div>
</section>

</body>
<script>

    $('.toggle').height($(window).height());
    // var URL = 'http://youxi.cc:9908/index.php/';
    var URL = 'http://strong.4kb.cn/index.php/';
    var oDiv = document.getElementById('link');
    var oA = oDiv.getElementsByTagName('a');
    for (var i = 0; i < oA.length; i++) {
        oA[i].onclick = function () {
            $('#link').children('a').removeClass('active');
            $(this).addClass('active');

            var j = $(this).attr('data');

            $.ajax({
                type: 'POST',
                url: URL + 'admin/index/checkAjax',
                data: {id: j},
                dataType: "json",
                success: function (data) {
                    console.log(data);
                    if (data == 1) {
                        alert('活动开启成功');
                        window.location.href="{:url('index/activity')}";
                    }
                    // else {
                    //     alert('活动已关闭');
                    //     window.location.href="{:url('login/loginout')}";
                    // }
                }
            });

        }
    }

</script>
</html>